using UnityEngine;
using System;

public class Tutorial : MonoBehaviour, IMessage
{
	public string[] TutorialMessages;
	
	private int MessageIndex = 0;
	private Vector2 ScrollPosition = Vector2.zero;
	
	private void nextButton()
	{
		if (MessageIndex < TutorialMessages.Length-1)
		{
			if (GUILayout.Button("Next", GUILayout.Width(50)))
			{
				MessageIndex++;
			}
		}
	}
	
	private void previousButton()
	{
		if (MessageIndex > 0)
		{
			if (GUILayout.Button("Back", GUILayout.Width(50)))
			{
				MessageIndex--;
			}
		}
	}
		
	public void Message (int WindowID)
	{
		GUILayout.BeginVertical();
			ScrollPosition = GUILayout.BeginScrollView(ScrollPosition);
				GUILayout.Label(TutorialMessages[MessageIndex]);
			GUILayout.EndScrollView();
			GUILayout.BeginHorizontal();
		 		GUILayout.FlexibleSpace();
				previousButton();
				nextButton();
			GUILayout.EndHorizontal();
		GUILayout.EndVertical();
	}
}